package com.th.supcom.pds.dispensedrug.server;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.carefx.framework.container.client.exception.UiException;
import net.carefx.framework.util.ConvertUtils;
import net.carefx.framework.web.gwt.server.GwtController;

import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.th.supcom.pds.dispensedrug.client.service.PdsSupplyDetailRpc;
import com.th.supcom.pds.domain.pojo.PdsPrescDetail;
import com.th.supcom.pds.domain.vo.PdsPrescDetailAndPrescVo;
import com.th.supcom.pds.internal.api.PdsSupplyDetailService;
import com.th.supcom.pds.sortingdrug.client.model.PdsPrescDetailInfoModel;

/**
 * PdsPrescDetail 控制层.
 * 
 * 处方明细.
 */
public class PdsSupplyDetailServiceController extends GwtController implements PdsSupplyDetailRpc
{
    /** 公司版权信息. */
    public static final String copyright = "Copyright 2014, TH Supcom Corporation";
    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";

    private static final long serialVersionUID = 1L;

    private PdsSupplyDetailService m_pdsSupplyDetailService;

    /**
     * 默认构造函数.
     */
    public PdsSupplyDetailServiceController ()
    {

    }

    public void setPdsSupplyDetailService (PdsSupplyDetailService pdsSupplyDetailService)
    {
    
        m_pdsSupplyDetailService = pdsSupplyDetailService;
    }

    @Override
    public void addPdsPrescDetail (final PdsPrescDetailInfoModel pdsPrescDetailInfoModel) throws UiException
    {
        final PdsPrescDetail pdsPrescDetail = ConvertUtils.convert (PdsPrescDetail.class, pdsPrescDetailInfoModel);
        // m_pdsSupplyDetailService.addPdsPrescDetail (pdsPrescDetail);
    }

    @Override
    public PdsPrescDetailInfoModel getPdsPrescDetailById (final Long id) throws UiException
    {
        return null;
    }

    @Override
    public List <PdsPrescDetailInfoModel> getPdsPrescDetailList (final PdsPrescDetailInfoModel model)
                                                                                                     throws UiException
    {
        final PdsPrescDetail pdsPrescDetail = ConvertUtils.convert (PdsPrescDetail.class, model);
        final List <PdsPrescDetail> pdsPrescDetails = null;
        // m_pdsSupplyDetailService.findPdsPrescDetailListByExample
        // (pdsPrescDetail);
        final List <PdsPrescDetailInfoModel> pdsPrescDetailInfoModels = ConvertUtils.convert (PdsPrescDetailInfoModel.class,
                                                                                              pdsPrescDetails);
        return pdsPrescDetailInfoModels;
    }

    @Override
    public PagingLoadResult <PdsPrescDetailInfoModel> getPdsPrescDetailListWithPaging (final PagingLoadConfig config)
    {

        return new BasePagingLoadResult <PdsPrescDetailInfoModel> (new ArrayList <PdsPrescDetailInfoModel> (),
                                                                   config.getOffset (), 10);
    }

    @Override
    public List <PdsPrescDetailInfoModel> getPrescDetailByPrescAndRcpt (final String rcptNo, final String prescNo)
                                                                                                                  throws UiException
    {
        final Map <String, Object> map = new HashMap <String, Object> ();
        map.put ("rcptNo", rcptNo);
        map.put ("prescNo", prescNo);
        final List <PdsPrescDetailAndPrescVo> pdsPrescDetailAndPrescVos = null;
        // m_pdsSupplyDetailService.getPrescDetailByPrescAndRcpt (map);
        return ConvertUtils.convert (PdsPrescDetailInfoModel.class, pdsPrescDetailAndPrescVos);
    }

    @Override
    public void modifyPdsPrescDetail (final List <PdsPrescDetailInfoModel> pdsPrescDetailInfoModel) throws UiException
    {
        final List <PdsPrescDetail> pdsPrescDetail = ConvertUtils.convert (PdsPrescDetail.class,
                                                                           pdsPrescDetailInfoModel);
        // m_pdsSupplyDetailService.modifyPdsPrescDetailByExample
        // (pdsPrescDetail);
    }

    @Override
    public void removePdsPrescDetail (final Long id) throws UiException
    {
        return;
    }

}